<?php

namespace app\admin\controller\yunfood;

use addons\yunfood\library\Backend;
use \addons\yunfood\model\ImportLog as ImportModel;

/**
 * 成员模块
 */
class ImportLog extends Backend
{
    /**
     * @var ImportModel
     */
    protected $model;

    // 初始化
    public function _initialize()
    {
        parent::_initialize();
        $this->model = new ImportModel();

        $this->view->assign('sceneList', $this->model::getSceneList());
        $this->assignconfig('sceneList', $this->model::getSceneList());

        $this->view->assign('statusList', $this->model::getStatusList());
        $this->assignconfig('statusList', $this->model::getStatusList());
    }

    /**
     * 查看
     */
    public function index()
    {
        $scene = $this->request->request('scene');
        if ($this->request->isAjax()) {
            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
            $query = $this->model->where($where);
            if ($scene) {
                $query->where(['scene' => $scene]);
            }
            $list = $query->order($sort, $order)->limit($offset, $limit)->paginate($limit);

            $result = array(
                'total' => $list->total(),
                'rows'  => $list->items(),
            );

            return json($result);
        }
        $this->assignconfig('scene', $scene);

        return $this->view->fetch(null, ['scene' => $scene]);
    }

    public function add()
    {
        return;
    }

    public function edit($ids = null)
    {
        return;
    }

    public function del($ids = null)
    {
        return;
    }

    public function multi($ids = null)
    {
        return;
    }

    public function recyclebin()
    {
        return;
    }

    public function destroy($ids = null)
    {
        return;
    }

    public function restore($ids = null)
    {
        return;
    }
}
